package com.matt.repository.course;

import com.matt.domain.course.ChildrenCourseItem;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;
import java.util.List;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/9/7
 * *******************************
 */
public interface ChildrenCourseItemRepository extends JpaRepository<ChildrenCourseItem, String> {
    List<ChildrenCourseItem> findByCoursePlanId(String coursePlanId);

    ChildrenCourseItem findByCoursePlanIdAndChildrenId(String coursePlanId, String childrenId);

    @Modifying
    Integer deleteByChildrenCourseIdAndStatus(String childrenCourseId, Integer status);

    @Modifying
    void deleteByCoursePlanId(String coursePlanId);

    List<ChildrenCourseItem> findByChildrenIdOrderByCreatedDesc(String childrenId);

    List<ChildrenCourseItem> findByChildrenIdAndStatus(String childrenId,Integer status);

}
